load c:\manoj\projects\substorm\HUA_2000_2004_ts HUA_ts HUA_ts_fday;

HP(2,:) = HUA_ts_fday;
HP(1,:) = HUA_ts;

HP = HP(:,1:5:end);
load c:\manoj\projects\ace\substorm;
%load c:\manoj\projects\substorm\selected_substorm;
%fday_substorm = selected_substorm;
%fday_substorm = non_selected_substorm;
i_counter=0;
radius_epoch = 1/24;


Longitude = 284.67; 
lt_correction = Longitude / 15;

if lt_correction > 12,
    lt_correction =  lt_correction - 12;
else,
    lt_correction = -lt_correction;
end;

local_time_start = 7;
local_time_end = 17;

st = ( local_time_start + lt_correction ) / 24;
en = ( local_time_end + lt_correction   ) / 24;




for i = 1:length(fday_substorm),
    
            if (fday_substorm(i)-floor(fday_substorm(i))) >= st && (fday_substorm(i)-floor(fday_substorm(i))) <= en,
           
           L = HP(2,:) > fday_substorm(i)-radius_epoch & ...
               HP(2,:) < fday_substorm(i)+radius_epoch;
           
           kk = sum(L);
           
           
           if kk ==  floor(radius_epoch*2*(1440/5)),
           i_counter = i_counter+1;
           SEG_HUA(i_counter,:) = HP(1,L);               
           if (mod(i,1000) == 0)
           display(i);
            end;
           end;
           
            end; 
           end;
           


